<!DOCTYPE html>
<html>
<head>
    <title>构造函数实现继承</title>
    <meta charset="utf-8"/>
    <script>
        //构造函数实现继承
         function  Parent(name){
             this.name = name;
             this.sayParent = function(){
                document.write("Parent:"+this.name + '<br/>');
             }
             this.sayHello = new Function("alert(this.name)");
         }
         function  Child(name, age){
             this.tempMethod = Parent;
             this.tempMethod(name);

             this.age = age;
             this.sayParent = function(){
                 document.write("Child:" + this.name + "age:" + this.age  +  '<br/>');
             }

         }
         var parent = new Parent("zhangping");
         parent.sayParent();
         var child = new Child("xiaoguanxianfei","11");
         child.sayParent();
    </script>
</head>
<body>

</body>
</html>